import { EntitySchema } from '@mikro-orm/core';

export class TypechoChatMsg {
  id!: number;
  uid?: number = 0;
  cid?: number = 0;
  text?: string;
  created?: number = 0;
  type?: number = 0;
  url?: string;
}

export const TypechoChatMsgSchema = new EntitySchema({
  class: TypechoChatMsg,
  properties: {
    id: { primary: true, type: 'number' },
    uid: { type: 'number', nullable: true, default: 0 },
    cid: { type: 'number', nullable: true, default: 0 },
    text: { type: 'string', columnType: 'text', nullable: true },
    created: { type: 'number', nullable: true, default: 0 },
    type: { type: 'number', nullable: true, default: 0 },
    url: { type: 'string', length: 400, nullable: true },
  },
});
